import { Tabs, TabItem } from '@aws-amplify/ui-react';
import { ThemeAlert } from '@/components/ThemeAlert';
Step 1: Wrap your App with `ThemeProvider`
```jsx
import { ThemeProvider } from '@aws-amplify/ui-react';
const App = (
/* AmplifyUI */
);
```
Step 2: Use the theme to style components
```jsx
// Option 1: Use the theme through component variations
import { Text } from '@aws-amplify/ui-react';
const MyComponent = ({ children }) => {
return {children};
};
// Option 2: Get the theme object through the useTheme hook and style components with it
import { Text, useTheme } from '@aws-amplify/ui-react';
const MyComponent = ({ children }) => {
const { tokens } = useTheme();
return {children};
};
```
Optional: To extend or override a token in the default theme, create a custom theme:
```jsx
import { ThemeProvider, Theme } from '@aws-amplify/ui-react';
// Step 1: Create a new Theme with your custom values
const theme = {
name: 'my-theme',
tokens: {
colors: {
font: {
primary: { value: '#008080' },
// ...
},
},
},
};
// Step 2: Pass the new theme to `ThemeProvider`
// this will apply the theme to all Amplify UI components
const App = (
/* AmplifyUI */
);
```
```tsx
import { ThemeProvider, Theme } from '@aws-amplify/ui-react';
// Step 1: Create a new Theme with your custom values
const theme: Theme = {
name: 'my-theme',
tokens: {
colors: {
font: {
primary: { value: '#008080' },
// ...
},
},
},
};
// Step 2: Pass the new theme to `ThemeProvider`
// this will apply the theme to all Amplify UI components
const App = (
/* AmplifyUI */
);
```